package com.ideaaedi.springcloud.jd.commonspring.sharding.properties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;

/**
 * 数据源相关参数
 * <br />
 * 注：因为本项目只有一个数据源，所以就直接注入了；如果是多个数据源的话，就得手动创建多个数据源对应的DatasourceArgs对象了
 *
 * @author JustryDeng
 * @since 2021.0.5.A
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DatasourceArgs {
    
    /**
     * 数据源名称
     */
    @Value("${spring.shardingsphere.datasource.names}")
    private String name;
    
    /**
     * url
     */
    @Value("${spring.shardingsphere.datasource.${spring.shardingsphere.datasource.names}.jdbc-url}")
    private String jdbcUrl;
    
    /**
     * 用户名
     */
    @Value("${spring.shardingsphere.datasource.${spring.shardingsphere.datasource.names}.username}")
    private String username;
    
    /**
     * 密码
     */
    @Value("${spring.shardingsphere.datasource.${spring.shardingsphere.datasource.names}.password}")
    private String password;

}
